import UIKit

//______________________________________________________
@available(iOS 2.0, *)
extension QKC where AA :UIControl {
		// default is YES. if NO, ignores touch events and subclasses may draw differently
    open func isEnabled_qk_s(_ isEnabled:  Bool ) -> QKC<AA,YY,ZZ, Bool >{
		return link(next: isEnabled).then_QK { $0.value.isEnabled = isEnabled }
	}
    open func isEnabled_qk_g() -> QKC<AA,YY,ZZ, Bool >{
		 self +^ self.value.isEnabled
	}

		// default is NO may be used by some subclasses or by application
    open func isSelected_qk_s(_ isSelected:  Bool ) -> QKC<AA,YY,ZZ, Bool >{
		return link(next: isSelected).then_QK { $0.value.isSelected = isSelected }
	}
    open func isSelected_qk_g() -> QKC<AA,YY,ZZ, Bool >{
		 self +^ self.value.isSelected
	}

		// default is NO. this gets set/cleared automatically when touch enters/exits during tracking and cleared on up
    open func isHighlighted_qk_s(_ isHighlighted:  Bool ) -> QKC<AA,YY,ZZ, Bool >{
		return link(next: isHighlighted).then_QK { $0.value.isHighlighted = isHighlighted }
	}
    open func isHighlighted_qk_g() -> QKC<AA,YY,ZZ, Bool >{
		 self +^ self.value.isHighlighted
	}

		// how to position content vertically inside control. default is center
    open func contentVerticalAlignment_qk_s(_ contentVerticalAlignment:  UIControl.ContentVerticalAlignment ) -> QKC<AA,YY,ZZ, UIControl.ContentVerticalAlignment >{
		return link(next: contentVerticalAlignment).then_QK { $0.value.contentVerticalAlignment = contentVerticalAlignment }
	}
    open func contentVerticalAlignment_qk_g() -> QKC<AA,YY,ZZ, UIControl.ContentVerticalAlignment >{
		 self +^ self.value.contentVerticalAlignment
	}

		// how to position content horizontally inside control. default is center
    open func contentHorizontalAlignment_qk_s(_ contentHorizontalAlignment:  UIControl.ContentHorizontalAlignment ) -> QKC<AA,YY,ZZ, UIControl.ContentHorizontalAlignment >{
		return link(next: contentHorizontalAlignment).then_QK { $0.value.contentHorizontalAlignment = contentHorizontalAlignment }
	}
    open func contentHorizontalAlignment_qk_g() -> QKC<AA,YY,ZZ, UIControl.ContentHorizontalAlignment >{
		 self +^ self.value.contentHorizontalAlignment
	}

		// how to position content horizontally inside control, guaranteed to return 'left' or 'right' for any 'leading' or 'trailing'
    open func effectiveContentHorizontalAlignment_qk_g() -> QKC<AA,YY,ZZ, UIControl.ContentHorizontalAlignment >{
		 self +^ self.value.effectiveContentHorizontalAlignment
	}

		// could be more than one state (e.g. disabled|selected). synthesized from other flags.
    open func state_qk_g() -> QKC<AA,YY,ZZ, UIControl.State >{
		 self +^ self.value.state
	}

    open func isTracking_qk_g() -> QKC<AA,YY,ZZ, Bool >{
		 self +^ self.value.isTracking
	}

		// valid during tracking only
    open func isTouchInside_qk_g() -> QKC<AA,YY,ZZ, Bool >{
		 self +^ self.value.isTouchInside
	}

	// get info about target & actions. this makes it possible to enumerate all target/actions by checking for each event kind
		// set may include NSNull to indicate at least one nil target
    open func allTargets_qk_g() -> QKC<AA,YY,ZZ, Set<AnyHashable> >{
		 self +^ self.value.allTargets
	}

		// list of all events that have at least one action
    open func allControlEvents_qk_g() -> QKC<AA,YY,ZZ, UIControl.Event >{
		 self +^ self.value.allControlEvents
	}

    open func beginTracking_qk_f(_ touch: UITouch, with event: UIEvent?) -> QKC<AA,YY,ZZ,Bool>{
		 self +^ self.value.beginTracking(touch, with:event)
	}

    open func continueTracking_qk_f(_ touch: UITouch, with event: UIEvent?) -> QKC<AA,YY,ZZ,Bool>{
		 self +^ self.value.continueTracking(touch, with:event)
	}

		// touch is sometimes nil if cancelTracking calls through to this.
    open func endTracking_qk_f(_ touch: UITouch?, with event: UIEvent?) -> QKC<AA,YY,ZZ, UITouch?>{
		 self +^ self.value.endTracking(touch, with:event) +^ touch
	}

		// event may be nil if cancelled for non-event reasons, e.g. removed from window
    open func cancelTracking_qk_f(with event: UIEvent?) -> QKC<AA,YY,ZZ, UIEvent?>{
		 self +^ self.value.cancelTracking(with:event) +^ event
	}

	// the action cannot be NULL. Note that the target is not retained.
    open func addTarget_qk_f(_ target: Any?, action: Selector, for controlEvents: UIControl.Event) -> QKC<AA,YY,ZZ, Any?>{
		 self +^ self.value.addTarget(target, action:action, for:controlEvents) +^ target
	}

	// remove the target/action for a set of events. pass in NULL for the action to remove all actions for that target
    open func removeTarget_qk_f(_ target: Any?, action: Selector?, for controlEvents: UIControl.Event) -> QKC<AA,YY,ZZ, Any?>{
		 self +^ self.value.removeTarget(target, action:action, for:controlEvents) +^ target
	}

		// single event. returns NSArray of NSString selector names. returns nil if none
    open func actions_qk_f(forTarget target: Any?, forControlEvent controlEvent: UIControl.Event) -> QKC<AA,YY,ZZ,[String]? >{
		 self +^ self.value.actions(forTarget:target, forControlEvent:controlEvent)
	}

	// send the action. the first method is called for the event and is a point at which you can observe or override behavior. it is called repeately by the second.
    open func sendAction_qk_f(_ action: Selector, to target: Any?, for event: UIEvent?) -> QKC<AA,YY,ZZ, Selector>{
		 self +^ self.value.sendAction(action, to:target, for:event) +^ action
	}

		// send all actions associated with events
    open func sendActions_qk_f(for controlEvents: UIControl.Event) -> QKC<AA,YY,ZZ, UIControl.Event>{
		 self +^ self.value.sendActions(for:controlEvents) +^ controlEvents
	}

}

